<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户管理</title>

<script type="text/javascript">
	 function saveUser(){
		//显示
		//alert(1);
		document.getElementById('saveUser').style.display='block';
	 }
</script>
</head>
<body>
	<h2>用户管理列表</h2>
     <button onclick="saveUser()">添加新用户</button>
     
     <form action="userList.action" method="post">
      <table border="1">
        <tr>
            <th>Id</th>
            <th>userName</th>
            <th>passWord</th>
            <th>Age</th>
            <th>Action</th>
        </tr>
        <c:forEach items="${users}" var="user">
            <tr>
                <td><c:out value="${user.id}"></c:out></td>
                <td><c:out value="${user.username}"></c:out></td>
                <td>${user.password}</td>
                <td>${user.age}</td>
                <td>
                <a href="editUserById.action?id=${user.id}">Edit</a>
                <a href="deleteUserById.action?id=${user.id}">Delete</a>
                </td>
            </tr>
         </c:forEach>
      </table>
   </form>
   
   <!-- 添加新用户 -->
   <div id="saveUser" style="display:none;">
	   <form action="saveUser.action" method="post">
	              用户名：<input type="text" name="username" id="username"/>
	              密   码：<input type="password" name="password" id="password"/>
	              年   龄：<input type="text" name="age" id="age"/>
	       <input type="submit" value="保存">
	   </form> 
   </div>
</body>
</html>